(function(){
  var index = 0;

$('.slider li').eq(index).addClass('current').siblings().removeClass('current')


$('.arrow-right').click(function () {
 
  index++;
 
  index = (index == $('.slider li').length) ? 0 : index;

  $('.slider li').eq(index).addClass('current').fadeIn(1000).siblings().removeClass('current').fadeOut(1000)
});


$('.arrow-left').click(function () {

  index--;
  
  index = (index < 0) ? $('.slider li').length - 1 : index;

  $('.slider li').eq(index).addClass('current').fadeIn(1000).siblings().removeClass('current').fadeOut(1000)
})



var times = setInterval(function () {
  $('.arrow-right').click();
}, 3000);

$('.slider').mouseenter(function () {

  clearInterval(times)
});


$('.slider').mouseleave(function () {
  times = setInterval(function () {
    $('.arrow-right').click();
  }, 3000);
});
})()